﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using HandyControl.Controls;
using HandyControl.Data;

namespace AgileLogistics.ViewModel
{
    [PropertyChanged.AddINotifyPropertyChangedInterface]
   public class MaterialViewModel:ViewModelBase
    {



        #region 菜单切换    
      
        public RelayCommand<FunctionEventArgs<object>> SwitchItemCmd => new Lazy<RelayCommand<FunctionEventArgs<object>>>(() => new RelayCommand<FunctionEventArgs<object>>(SwitchItem)).Value;



        private void SwitchItem(FunctionEventArgs<object> info) => Growl.Info((info.Info as SideMenuItem)?.Header.ToString());

        private RelayCommand<string> menuChange => new Lazy<RelayCommand<string>>(()=> new RelayCommand<string>(MenuChangeFunc)).Value;


        public RelayCommand<string> MenuChange
        {
            get
            {
                return menuChange;
            }
        }
        

        private void MenuChangeFunc(string menuHeader)
        {
            //HandyControl.Controls.Growl.SuccessGlobal(menuHeader);

            Page page = new Page();
            switch (menuHeader)
            {
                default:

                    break;
                case "新建申请单":
                   // Growl.SuccessGlobal("新建页面");
                    page = new View.Cailiao.NewPage();
                    break;
                case "待办申请单":
                   // Growl.SuccessGlobal("查询页面");
                    page = new View.Cailiao.BillPage();
                    break; 
                case "已处理申请单":
                   
                    page = new View.Cailiao.ListPage();
                    break;
                case "部门申请单":

                    page = new View.Cailiao.ListPage();
                    break;
                case "我创建的申请单":

                    page = new View.Cailiao.ListPage(false);
                    break;
                case "所有材料":

                    page = new View.Cailiao.CURD.ListPage();
                    break;
                case "新增材料":

                    page = new View.Cailiao.CURD.CreatePage();
                    break;

            }

            GalaSoft.MvvmLight.Messaging.Messenger.Default.Send<Page>(page, "NavigatePage");
        }


        #endregion


        public List<Model.Depment> depList { get; set; }

        #region 材料增删改查
        public Model.Materials CurrentMaterial { get; set; }
        public List<Model.Materials> MaterialList { get; set; }
        #endregion



        #region 申请单
        public Model.MaterialBill CurrBill { get; set; }
        public List< Model.MaterialBill>  BillList { get; set; }
        #endregion



        #region Home数据
        public int SumCount { get; set; }
        public int NewCount { get; set; }
        public int CompleteCount { get; set; }




        public List<int> NewList { get; set; }
        public List<int> HandleList { get; set; }
        public List<int> XiaolvList { get; set; }




        public List<string> WeekLabels = new List<string>();
        #endregion
    }
}
